﻿using System.Collections.Generic;

namespace LxCFD
{
    public class MGMeshCreator
    {
        public int maxCoarseLevelLimit;

        public MGZoneCreator zoneCreator;
        public MGContactCreator contactCreator;
        public QueueTool QueueTool_O = new QueueTool();
        public QueueTool QueueTool_N = new QueueTool();
        public void Create(int maxCoarseLevelLimit, int groupNum, int maxZoneCellCount)
        {
            if (maxCoarseLevelLimit > 0)
            {
                this.maxCoarseLevelLimit = maxCoarseLevelLimit;
            }
            else
            {
                LxConsole.Error("粗网格级数必须大于0，自动更改为50");
                this.maxCoarseLevelLimit = 50;
            }
            zoneCreator = new MGZoneCreator();
            contactCreator = new MGContactCreator();
            if (groupNum > 1)
            {
                zoneCreator.TargetCoarseNum = groupNum;
            }
            else
            {
                LxConsole.Error("形成粗网格的细网格数量必须大于1，已自动更改为4");
                zoneCreator.TargetCoarseNum = 4;
            }
            zoneCreator.InCoarseCell = new int[maxZoneCellCount];
            zoneCreator.GroupCells = new int[groupNum * 10];
            zoneCreator.coarseCells = new List<MGCellTemp>();
            zoneCreator.coarseFaces = new List<MGFaceTemp>();
            zoneCreator.QueueTool_O = QueueTool_O;
            zoneCreator.QueueTool_N = QueueTool_N;

            contactCreator.QueueTool_O = QueueTool_O;
            contactCreator.QueueTool_N = QueueTool_N;
        }
    }
}
